package com.lysj.order.order.domain;

import com.lysj.admin.utils.spring.foundation.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author Created by drj on 2019-03-07 16:36:33
 * @description 订单控制层
 */
@Data
@Entity
@EqualsAndHashCode(callSuper = true)
@Table(name = "lysj_order_order")
public class Order extends BaseEntity {
    @Getter
    public enum PayWay {
        CASH(1, "现金"),
        WECHAT(2, "微信");
        private Integer code;

        private String status;

        PayWay(Integer code, String status) {
            this.code = code;
            this.status = status;
        }
    }

    @Getter
    public enum Status {
        PLACEORDER(1, "下单"),
        SUCCESSPAY(2, "支付成功"),
        REFUNDAPPLY(3, "退款申请"),
        REFUNDSUCCESS(4, "退款成功"),
        REFUNDFAIL(5, "退款失败");
        private Integer code;

        private String status;

        Status(Integer code, String status) {
            this.code = code;
            this.status = status;
        }
    }

    private String orderNumber;//订单编号

    private String deskId;//餐桌id

    private Integer cusAmount;//用餐人数

    @Column(columnDefinition = "decimal(10,2)")
    private BigDecimal disCountMoney; //优惠金额

    @Column(columnDefinition = "decimal(10,2)")
    private BigDecimal actPayMoney;//实付金额

    @Column(columnDefinition = "decimal(10,2)")
    private BigDecimal refundPayMoney;//退款金额

    private Integer payWay;//支付方式

    private Integer status;//订单状态

    private String storeId;//门店id

    private String customerId;//用户id


    @Transient
    private List<OrderItem> orderItemList; //菜品详情

}